Skip to main content

Webhook Integration

To seamlessly receive notifications for confirmed transactions, integrate with our advanced webhook solution. Follow the steps below to set up webhook integration successfully:

Requirements:

  1. Webhook Verification Key: Obtain your unique webhook verification key from here.

  2. Pass Webhook URL at Checkout-Session Creation: During the creation of a checkout session, ensure that you include the webhook URL. Refer to the documentation here for details.

Code Examples:

Check verification key

You MUST make sure to verify the webhook key to avoid malicious requests.

Webhook Response

The webhook view should return a 200 response code, our system will retry to call it for any other response code

import os
from fastapi import FastAPI, Request


# Create the FastAPI app
app = FastAPI()

@app.post('/notrix-webhook')
async def notrix_webhook(request: Request):
# Get the webhook verification key from the header
webhook_key = request.headers['X-Notrix-Webhook-Key']
if webhook_key != os.environ['WEBHOOK_VERIFICATION_KEY']:
return {'message': 'invalid webhook key'}, 401

# Load order from body
order = await request.json()

# Start post-payment processing
# ...

return 200

Webhook Payload:

Upon successful integration, the webhook payload will furnish comprehensive order details, including the unique checkout session UUID (checkout-session-uuid). Stay informed about confirmed transactions effortlessly with Notrix's webhook integration.

order payload example
{
"created_at": "2024-04-15T17:54:49.657172327Z",
"uuid": "30190f78-ea2f-4a52-a5a0-b8a7e05ecdec",
"paidFrom": "<wallet address>",
"priceInCurrency": "147947596",
"priceInUSD": "1",
"checkoutSessionUuid": "610a362b-40fd-43e5-b695-e1ad057cdfbf",
"checkoutSession": {
"uuid": "610a362b-40fd-43e5-b695-e1ad057cdfbf",
"totalAmount": "1", // USD
"successURL": "http://demo.notrix.io/post-payment",
"cancelURL": "http://demo.notrix.io",
"clientReferenceID": null,
"active": false,
"showCompany": false,
"expires_at": "2024-04-16T17:51:41.559279Z",
"status": "paid",
"paymentRequestToken": "kp3vODJmftOb4H75EVktvLQkqxRf4S",
"webhookURL": "https://demo.notrix.io/post-payment/webhook",
"lineItems": null
},
"walletUuid": "b92a589b-ff34-4b65-a1e1-2d5f33dc2128",
"wallet": {
"uuid": "b92a589b-ff34-4b65-a1e1-2d5f33dc2128",
"address": "<wallet address>",
"grossIncome": "1363858107",
"commision": "0",
"active": true,
"currency_uuid": "6ac38c5d-6ab5-41f7-bc1e-ed6ada0bfc3a",
}
}